<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<!--
        	作者：13024022425@163.com
        	时间：2017-10-23
        	描述：引入angularjs
        -->
	<script src="../js/angular.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<div ng-app="myApp" ng-controller="myCtrl">
			<table border="1" cellspacing="" cellpadding="">
				<tr>
					<th>序号</th>
					<th>商品编号</th>
					<th>商品名字</th>
					<th>商品价格</th>
				</tr>
				<tr ng-repeat="product in products">
					<td>{{$index+1}}</td>
					<td>{{product.id}}</td>
					<td>{{product.name}}</td>
					<td>{{product.price}}</td>
				</tr>
			</table>
		</div>
		<script type="text/javascript">
			//获取模块对象：相当于java的myApp=getModel(myApp)方法获取模块
			var myApp = angular.module("myApp",[]);
			//在模块对象上初始化控制器
			myApp.controller('myCtrl',['$scope',function ($scope) {
				//初始化一个集合json数组
				$scope.products=[
				{'id':1001,'name':'电视机','price':'998'},
				{'id':2002,'name':'路由器','price':'188'}
				];
			}]);
		</script>
	</body>
</html>
